﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.Objects;

namespace SCMS.Model
{
    public static class BudgetExtensions
    {
        #region .BudgetPosting.

        public static IQueryable<BudgetPosting> IncludeProjectBudgetViaRFP(this IQueryable<BudgetPosting> queryable)
        {
            return ((ObjectQuery<BudgetPosting>)queryable).Include("PaymentRequestBudgetLine.ProjectBudget");
        }

        public static IQueryable<BudgetPosting> IncludeRequestForPayment(this IQueryable<BudgetPosting> queryable)
        {
            return ((ObjectQuery<BudgetPosting>)queryable).Include("PaymentRequestBudgetLine.PaymentRequest");
        }

        public static IQueryable<BudgetPosting> IncludePurchaseOrder(this IQueryable<BudgetPosting> queryable)
        {
            return ((ObjectQuery<BudgetPosting>)queryable).Include("PaymentRequestBudgetLine.PurchaseOrderItem.PurchaseOrder");
        }

        public static IQueryable<BudgetPosting> IncludeOrderRequestViaRFP(this IQueryable<BudgetPosting> queryable)
        {
            return ((ObjectQuery<BudgetPosting>)queryable).Include("PaymentRequestBudgetLine.PurchaseOrderItem.OrderRequestItem.OrderRequest");
        }

        public static IQueryable<BudgetPosting> IncludeItemViaRFP(this IQueryable<BudgetPosting> queryable)
        {
            return ((ObjectQuery<BudgetPosting>)queryable).Include("PaymentRequestBudgetLine.PurchaseOrderItem.OrderRequestItem.Item");
        }

        public static IQueryable<BudgetPosting> IncludePerson(this IQueryable<BudgetPosting> queryable)
        {
            return ((ObjectQuery<BudgetPosting>)queryable).Include("Staff.Person");
        }

        public static IQueryable<BudgetPosting> IncludeDesignation(this IQueryable<BudgetPosting> queryable)
        {
            return ((ObjectQuery<BudgetPosting>)queryable).Include("Staff.Designation");
        }

        #endregion

        #region .Rebooking.

        public static IQueryable<Rebooking> IncludeProjectDonor(this IQueryable<Rebooking> queryable)
        {
            return ((ObjectQuery<Rebooking>)queryable).Include("BudgetPosting.PaymentRequestBudgetLine.ProjectBudget.BudgetCategory.ProjectDonor");
        }

        public static IQueryable<Rebooking> IncludeRequestForPayment(this IQueryable<Rebooking> queryable)
        {
            return ((ObjectQuery<Rebooking>)queryable).Include("BudgetPosting.PaymentRequestBudgetLine.PaymentRequest");
        }

        public static IQueryable<Rebooking> IncludePurchaseOrder(this IQueryable<Rebooking> queryable)
        {
            return ((ObjectQuery<Rebooking>)queryable).Include("BudgetPosting.PaymentRequestBudgetLine.PurchaseOrderItem.PurchaseOrder");
        }

        public static IQueryable<Rebooking> IncludeOrderRequestViaRFP(this IQueryable<Rebooking> queryable)
        {
            return ((ObjectQuery<Rebooking>)queryable).Include("BudgetPosting.PaymentRequestBudgetLine.PurchaseOrderItem.OrderRequestItem.OrderRequest");
        }

        public static IQueryable<Rebooking> IncludeItemViaRFP(this IQueryable<Rebooking> queryable)
        {
            return ((ObjectQuery<Rebooking>)queryable).Include("BudgetPosting.PaymentRequestBudgetLine.PurchaseOrderItem.OrderRequestItem.Item");
        }

        public static IQueryable<Rebooking> IncludePerson(this IQueryable<Rebooking> queryable)
        {
            return ((ObjectQuery<Rebooking>)queryable).Include("Staff.Person");
        }

        public static IQueryable<Rebooking> IncludeDesignation(this IQueryable<Rebooking> queryable)
        {
            return ((ObjectQuery<Rebooking>)queryable).Include("Staff.Designation");
        }

        #endregion

        #region .ProjectBudget.

        public static IQueryable<ProjectBudget> IncludeGeneralLedger(this IQueryable<ProjectBudget> queryable)
        {
            return ((ObjectQuery<ProjectBudget>)queryable).Include("GeneralLedger");
        }

        #endregion

        #region .BudgetCategory.

        public static IQueryable<BudgetCategory> IncludeProjectDonor(this IQueryable<BudgetCategory> queryable)
        {
            return ((ObjectQuery<BudgetCategory>)queryable).Include("ProjectDonor");
        }

        #endregion
    }
}